<?
require_once('./lib/authentication.lib.php');
require_once('./lib/common.lib.php');

if (isset($_GET["player"]))
{
	$player_id = mysql_escape_string($_GET["player"]);

	$query = "SELECT Championship.name champ_name, Championship.begin, Championship.end, Team.name team_name from team_player, Team, Championship WHERE team_player.team = Team.id AND team_player.champ = Championship.id AND team_player.player = '$player_id';";
	$result_champ = mysql_query($query);
	while ($row_champ = mysql_fetch_assoc($result_champ))
	{
		$begin = substr($row_champ["begin"], 0, 4);
		$end = substr($row_champ["end"], 0, 4);
		echo $row_champ["champ_name"] . " $begin" . (($begin !== $end) ? "/$end" : "");
		echo " - " . $row_champ["team_name"] . "<BR>\n";
	}
}

